<template>
	<view>
		<view class="header">
			<!-- <statusbar></statusbar> -->
			<u-navbar title="商家管理" leftIconColor='#fff' titleStyle='color:#fff;' @rightClick="rightClick"
				bgColor='transparent' :autoBack="true"></u-navbar>
			<view class="sjinfo flex">
				<view class="info_left flex">
					<image class="avatar" :src="userinfo.avatar" mode=""></image>
					<view class="busness_name">
						{{merchant.realname||''}}
					</view>
				</view>
				<image @click="clickto('/pages/business/bussnessifon')" class="edit_btn" src="/pages/business/static/edit.png" mode=""></image>
			</view>
			<view class="xsbox flex">
				<view class="xsitem">
					<view class="xsname">
						销售总额
					</view>
					<view class="xsnum">
						{{merchant.allPrice||0}}
					</view>
				</view>
				<view class="xsline">
					
				</view>
				<view class="xsitem">
					<view class="xsname">
						惠值积分数量
					</view>
					<view class="xsnum">
						{{merchant.score||0}}
					</view>
				</view>
				<view class="xsline">
					
				</view>
				<view class="xsitem">
					<view class="xsname">
						贡献值数量
					</view>
					<view class="xsnum">
						{{merchant.score_two||0}}
					</view>
				</view>
			</view>
		</view>
		
		<view class="conbox flex">
			<view class="con_item" v-for="(item,index) in gllist" :key="index" @click="clickto(item.url)">
				<image class="icon" :class="item.iconClass" :src="item.icon" mode=""></image>
				<view class="item_name">
					{{item.name}}
				</view>
				<view class="item_line">
					
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {getMerchant,getStore} from '@/api/product.js'
	export default {
		data() {
			return {
				gllist:[
					{name:'商品管理',icon:'/pages/business/static/sp.png',iconClass:'sp_icon',url:'/pages/business/commodity'},
					{name:'订单管理',icon:'/pages/business/static/dd.png',iconClass:'dd_icon',url:'/pages/business/ordermanage'},
					{name:'通政账户',icon:'/pages/business/static/tz.png',iconClass:'tz_icon',url:'/pages/business/tongzheng'},
					{name:'财务明细',icon:'/pages/business/static/cw.png',iconClass:'cw_icon',url:'/pages/business/mingx'},
				],
				merchant:{},
				userinfo:{},
				store:{}
			};
		},
		methods:{
			clickto(url){
				// 判断商家店铺状态
				if(this.store){//申请了店铺
					if(this.store.status=='待审核'){//店铺审核中
						uni.showToast({
							title:'您的店铺申请正在审核中',
							icon:'none'
						})
						return
					}
				}
				uni.$u.route(url)
			},
			back(){
				uni.navigateBack()
			}
		},
		onLoad() {
			this.userinfo=uni.getStorageSync('userinfo')
			getMerchant({id:uni.getStorageSync('userinfo').user_id}).then(res=>{
				this.merchant=res.data.data
			})
			getStore().then(res=>{
				// console.log(res)
				this.store=res.data.data.store
			})
		}
	}
</script>

<style lang="less">
	page{
		background-color: #F7F7F9;
	}
.header{
	width: 750rpx;
	// height: 473rpx;
	background: linear-gradient(-45deg, #FE712A, #F85707);
	box-shadow: 10rpx 7rpx 55rpx 0px rgba(248,89,10,0.06);
	padding-bottom: 52rpx;
	.header_title{
		
		.back_icon{
			margin-left: 27rpx;
			width: 24rpx;
			height: 38rpx;
			margin-right: 252rpx;
		}
		.title_name{
			color: #fff;
			font-size: 36rpx;
		}
	}
	.avatar{
		width: 82rpx;
		height: 82rpx;
		border-radius: 50%;
		border: 6rpx solid #fd9b69;
		margin-right: 20rpx;
	}
	.edit_btn{
		width: 126rpx;
		height: 52rpx;
	}
	.sjinfo{
		justify-content: space-between;
		padding: calc(44px + 74rpx + var(--status-bar-height)) 30rpx 79rpx;
		color: #fff;
		font-size: 30rpx;
	}
	.xsbox{
		justify-content: space-between;
		padding: 0 73rpx;
		.xsitem{
			text-align: center;
			.xsname{
				color: #fff;
				font-size: 24rpx;
			}
			.xsnum{
				font-size: 36rpx;
				color: #fff;
				font-weight: bold;
				margin-top: 6rpx;
			}
			
		}
		.xsline{
			width: 1rpx;
			height: 29rpx;
			background: #fff;
			opacity: 0.2;
			// margin: 0 72rpx;
		}
	}
}
.conbox{
	padding: 34rpx 31rpx;
	justify-content: space-between;
	flex-wrap: wrap;
	.con_item{
		position: relative;
		width: 331rpx;
		height: 165rpx;
		background: #FFFFFF;
		border-radius: 16rpx;
		margin-bottom: 24rpx;
		.item_name{
			font-size: 30rpx;
			color: #212121;
			padding: 26rpx 0 10rpx 31rpx;
			
		}
		.item_line{
			width: 18rpx;
			height: 5rpx;
			background: #212121;
			margin-left: 34rpx;
		}
		.icon{
			
			position: absolute;
			top: 72rpx;
			right: 36rpx;
		}
		.sp_icon{
			width: 78rpx;
			height: 64rpx;
		}
		.dd_icon{
			width: 74rpx;
			height: 66rpx;
		}
		.tz_icon{
			width: 81rpx;
			height: 63rpx;
		}
		.cw_icon{
			width: 79rpx;
			height: 60rpx;
		}
	}
}
</style>
